#include "Projection.h"

namespace Rz { namespace Graphics { namespace Math {

Projection Projection::CreatePerspectiveFieldOfView(f32 fieldOfView, f32 aspectRatio, f32 nearPlane, f32 farPlane)
{
	Projection result;

	result.SetMatrix(Matrix4::CreatePerspectiveFieldOfView(fieldOfView, aspectRatio, nearPlane, farPlane));
	result.SetNearFar(Vector2(nearPlane, farPlane));

	return result;
}

Projection Projection::CreateOrthographic(f32 width, f32 height, f32 nearPlane, f32 farPlane)
{
	Projection result;

	result.SetMatrix(Matrix4::CreateOrthographic(width, height, nearPlane, farPlane));
	result.SetNearFar(Vector2(nearPlane, farPlane));

	return result;
}

const Matrix4& Projection::GetMatrix() const
{ 
	return _matrix; 
}

Matrix4& Projection::GetMatrix() 
{ 
	return _matrix; 
}

void Projection::SetMatrix(const Matrix4& matrix)
{ 
	_matrix = matrix;
}

const Vector2& Projection::GetNearFar() const 
{ 
	return _nearFar; 
}

Vector2& Projection::GetNearFar() 
{ 
	return _nearFar; 
}

void Projection::SetNearFar(const Vector2& nearFar) 
{ 
	_nearFar = nearFar; 
}

} } }

